﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Http;
using SIS_Wcf_Server.Model;

namespace ConsoleRestTest
{
    class Program
    {
        static void Main(string[] args)
        {
            using (HttpClient client = new HttpClient("http://localhost/SISServer/"))
            {
                // Getting the response as a string 
                Console.WriteLine("Search");
                List<Search> reqData = new List<Search>();
                reqData.Add(new Search { Type="WLAN", SearchString="TEST"});
                reqData.Add(new Search { Type="WLAN", SearchString="TEST2"});

                var content = Microsoft.Http.HttpContentExtensions.CreateJsonDataContract<List<Search>>(reqData); 
                var req = new HttpRequestMessage(HttpMethod.POST.ToString(),"Information/search/test");
                req.Content = content;

                using (HttpResponseMessage response = client.Send(req))
                {
                    response.EnsureStatusIsSuccessful();
                    Console.WriteLine(response.Content.ReadAsString());
                }
                Console.ReadKey();
            }
        }
    }
}
